<script type="text/javascript">
function logout()
{
if (confirm('vous voulez déconnecter ?')) {
		
		$.post("<?=site_url('logout')?>", function(data) {
			
			window.location.reload();
			});
		
	   }
}
</script>
<div class="logo_home"><img src="<?=base_url()?>resources/imgs/logo.png" alt="" width="200"></div>

<div class="home_banner">
<span class="sub-logo">* Livraison à Domicile Gratuite *</span>
<div class="shop_ctn">
<?php foreach ($shop as $s):?>
<div class="shop" >
<h3><?=$s->shop_name?></h3>
<p><?=$s->address?></p>
<p><img src="<?=base_url()?>resources/imgs/telephone.png" height="15"  alt="telephone" title="telephone"/><?=$s->tele?><br><br><img src="<?=base_url()?>resources/imgs/fax.png" height="17"  alt="telephone" title="fax"/><?=$s->fax?></p>
<p><?=$s->open_day?><br><?=$s->open_hour?></p>
			<div class="status">
			Actuellement: <br>
			<?php if($s->id==1){
				if( ( time() > strtotime('11:30') && time()< strtotime('14:00') ) || ( time() > strtotime('17:00') && time() < strtotime('22:00') ) ){echo 'Ouvert';}else{echo '<h3 class="closed">Fermé</h3>';}
				
			}elseif ($s->id==2){
			if( ( time() > strtotime('11:30') && time()< strtotime('14:00') ) || ( time() > strtotime('17:30') && time() < strtotime('22:30') ) ){echo '<h3 class="closed">Fermé</h3>';}else{echo '<h3 class="closed">Fermé</h3>';}
				
			}elseif ($s->id==3){
				if($s->id==3 && date('l')=='Sunday'){ 
					echo '<h3 class="closed">Fermé</h3>'; 
				}else{
					
				if( ( time() > strtotime('11:30') && time()< strtotime('14:00') ) || ( time() > strtotime('17:30') && time() < strtotime('22:30') ) ){echo 'Ouvert';}else{echo '<h3 class="closed">Fermé</h3>'; }
				
				}
					
			}?>
			</div>
</div>
<?php endforeach;?>
<div class="clear"></div>
</div>
<p class="sub-title">Meilleur Traiteur Chinois À Bruxelles</p>
<div class="clear"></div>
</div>


 
<div id="btn_home">

	<h3>Choisissez-vous votre mode de paiement</h3>
	<input value="paiement par carte" type="button" class="button" onclick="choose_payment()">
	<input value="paiement par espèces <?php if($this->discount){?>-<?=$this->discount[0]->discount_val*100?>%<?php }?>" type="button" class="button" onclick="location.href='<?=site_url('menu')?>'">
	<?php if($this->discount){?>
	<div class="promo">
	A partir du <?=date('d M. Y',strtotime($this->discount[0]->discount_start))?> jusqu'au <?=date('d M. Y',strtotime($this->discount[0]->discount_end))?>, Une Réduction de <?=$this->discount[0]->discount_val*100?>% pour toutes les commandes en ligne, paiement par espèces !!!
	</div>
	<?php }?>
	<?php if($this->discount_delivery){?>
	<div class="promo">
	
	A partir du <?=date('d M. Y',strtotime($this->discount_delivery[0]->discount_start))?> jusqu'au <?=date('d M. Y',strtotime($this->discount_delivery[0]->discount_end))?>,  Pour les commandes de livraison en ligne, Une Réduction de <?=$this->discount_delivery[0]->discount_val*100?>% 
	pour les communes: <br>
	<?php foreach ($this->discount_delivery[0]->community as $c):?>
	<?=$c->code?> <?=$c->name?> / 
	<?php endforeach;?>
	!!!
	</div>
	<?php }?>
	
	<div class="connect_home">
	<hr>
	<?php if(!$this->member){?>
	<img style="vertical-align: bottom;" src="<?=base_url()?>resources/imgs/login.png" alt="Identifiez-vous" title="Identifiez-vous"> <a href="<?=site_url('login')?>">Identifiez-vous</a>
	<?php }else{?>
	 <img src="<?=base_url()?>resources/imgs/profile.png" alt="Compte" title="Compte" > <a href="<?=site_url('account')?>"><?=$this->member->firstname?> <?=$this->member->lastname?></a> | <img src="<?=base_url()?>/resources/imgs/cart.png" alt="Panier" title="Panier" height="16"> <a href="<?=site_url('cart')?>">Panier
			<?=$this->cart->total_items()?>
			|
			<?=number_format($this->cart->total(),2,'.','')?>
			€</a> | <img src="<?=base_url()?>resources/imgs/logout.png" alt="Déconnexion" title="Déconnexion" height="16"> <a href="javascript:void(0)" onclick="logout()"">Déconnexion</a>
	<?php }?>
	<?php if($cartes):?>
<?php foreach ($cartes as $carte):?>
| <img style="vertical-align: middle;" src="<?=base_url()?>resources/imgs/book_alt.png" alt="menu_carte" title="menu_carte" height="14"> <a href="<?=base_url('carte_pdf')?>/<?=$carte['name']?>" target="_blank">Notre Carte</a>
<?php endforeach;?>
<?php endif;?>

<?php if($files):?>
<?php foreach ($files as $file):?>
<br><br><br><a href="<?=base_url('lunch_pdf')?>/<?=$file['name']?>" target="_blank">&#9733; Plat du jour de la semaine &#9733;</a>

<?php endforeach;?>
<?php endif;?>
<br><br>
<h4><a href="<?=site_url('conditions')?>">A savoir & Conditions de Livraison</a></h4>
	</div>
</div>


<div class="overflow">
<div class="bg"></div>
<div class="payment">
<h3>Choisissez-vous votre commune:</h3>
<form action="" method="post" name="send_form">
<select name="shop_id" class="styled-select">
<option value="null">votre commune...</option>
<?php foreach($communes as $c):?>
<option value="<?=$c->delivery?>"><?=$c->code?> <?=$c->name?></option>
<?php endforeach;?>
</select>
<input type="button" class="button" value="validez" onclick="valide_form()"> 
</form>
<br><br><input value="fermer X" type="button" class="button" onclick="close_overflow()">

</div>


</div>
<script type="text/javascript">
	function valide_form()
	{
		$shop_id = $('select').val();
		if($shop_id =='null'){
				alert('vouillez-vous choisir votre commnue,svp');
			}else{
					document.send_form.submit();	

				}
	}
 	function choose_payment(){

		$('.overflow').fadeIn('100');

 	 	}
	function close_overflow(){
		$('.overflow').fadeOut('100');
		}

</script>